package com.szecsenyi.performance;

import java.util.LinkedList;
import java.util.Random;
import java.util.Vector;

public class ListCompare {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		final Random random = new Random();
		
		Vector<Integer> arrayList = new Vector<Integer>();
		long currTime = System.currentTimeMillis();
		
		for(int i=0; i<1000000; i++){
			arrayList.add(random.nextInt(100));
		}
		
		System.out.println(System.currentTimeMillis()-currTime);
		currTime = System.currentTimeMillis();
		
		
		for(int i=0; i < arrayList.size(); i++){
			arrayList.get(random.nextInt(arrayList.size()));
		}

		System.out.println(System.currentTimeMillis()-currTime);
		currTime = System.currentTimeMillis();
		
		/*
		for(int i=arrayList.size()-1; i == 0; i--){
			arrayList.remove(i);
		}
		*/
			
		/*
		for(int i=0; arrayList.size() > 0; ){
			arrayList.remove(i);
		}
		*/
		
		for(int i=0; arrayList.size() > 0; ){
			arrayList.remove(random.nextInt(arrayList.size()));
		}
		
		System.out.println(System.currentTimeMillis()-currTime);
		currTime = System.currentTimeMillis();
				
		
	}

}
